%%                                   
%%
%% This is file 'pdfdraftcopy.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%%
%% pdfdraftcopy.dtx  (with options: 'package')
%%
%% File: pdfdraftcopy.dtx Copyright (c) 2003, C. V. Radhakrishnan
%%                                            C. V. Rajagopal
%% River Valley Technologies, Floor III, SJP Buildings
%% Cotton Hills, Trivandrum, India 695014
%% http://www.river-valley.com
%%
%% This package may be distributed under the terms of the LaTeX Project 
%% Public License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
%% $Id: pdfdraftcopy.sty,v 1.2 2003/08/11 20:31:07 cvr Exp cvr $
%%
\NeedsTeXFormat{LaTeX2e}
\def\Fileversion$#1: #2 ${\gdef\fileversion{#2}}
\def\Filedate$#1: #2 #3 ${\gdef\filedate{#2}}
\Fileversion$Revision: 1.2 $
\Filedate$Date: 2003/08/11 20:31:07 $
\ProvidesPackage{pdfdraftcopy}
   [\filedate\space\fileversion\space Draft copy in PDF (CVR)]
\PackageWarningNoLine{pdfdraftcopy}
   {****************************************\MessageBreak
    Package pdfdraftcopy v,\fileversion\space loaded\MessageBreak
    [Draft copy in PDF (CVR)]\MessageBreak
    ****************************************}
\DeclareOption{watermark}{\AtBeginDocument{%
     \begingroup\watermark\endgroup}}
\DeclareOption{draft}{\AtBeginDocument{%
   \begingroup\draftcopy\endgroup}}
\ExecuteOptions{draft}
\ProcessOptions\relax

\RequirePackage{color,graphicx}

\let\@DRAFTout@Hook\@empty
\newcommand{\DRAFTout}{\g@addto@macro\@DRAFTout@Hook}
\newcommand{\@DRAFTout@Out}{%
   \afterassignment\@DRAFTout@Test
   \global\setbox\@cclv= %
   }
\newcommand{\@DRAFTout@Test}{%
   \ifvoid\@cclv\relax
      \aftergroup\@DRAFTout@Output
   \else
      \@DRAFTout@Output
   \fi%
   }
\newcommand{\@DRAFTout@Output}{%
   \@DRAFTout@Hook%
   \@DRAFTout@Org@Out\box\@cclv%
   }
\newcommand{\@DRAFTout@Org@Out}{}
\newcommand*{\@DRAFTout@Init}{%
   \let\@DRAFTout@Org@Out\shipout
   \let\shipout\@DRAFTout@Out
   }
\AtBeginDocument{\@DRAFTout@Init}
\newcommand{\@DraftOverlay@Hook}{}
\newcommand{\AddToDraftOverlay}{\g@addto@macro\@DraftOverlay@Hook}
\newcommand{\ClearDraftOverlay}{\let\@DraftOverlay@Hook\@empty}
\newcommand{\@DraftOverlay}{%
  \ifx\@DraftOverlay@Hook\@empty
  \else
    \bgroup
      \@tempdima=1in
      \@tempcnta=\@tempdima
      \@tempcntb=-\@tempdima
      \advance\@tempcntb\paperheight
      \global\setbox\@cclv\vbox{%
      \vbox{\let\protect\relax%
        \unitlength=1sp%
        \pictur@(0,0)(\@tempcnta,\@tempcntb)%
          \@DraftOverlay@Hook%
        \endpicture}%
        \box\@cclv%
      }%
    \egroup
  \fi
}

\definecolor{gray30}{gray}{.7}
\definecolor{gray20}{gray}{.8}
\definecolor{gray10}{gray}{.9}

\DRAFTout{\@DraftOverlay}
\newdimen\LLY
\newdimen\LLX
\newdimen\URX
\newdimen\URY
\newdimen\topmargin
\newdimen\bottommargin
\def\@printdimen{%\ifthenelse{\equal{\@debug}{true}}%
  {\PackageWarningNoLine{PDFdraftcopy}%
    {\LLX::::::::::::=\the\LLX\MessageBreak
     \LLY::::::::::::=\the\LLY\MessageBreak
     \URX::::::::::::=\the\URX\MessageBreak
     \URY::::::::::::=\the\URY\MessageBreak
     \oddsidemargin::=\the\oddsidemargin\MessageBreak
     \evensidemargin:=\the\evensidemargin\MessageBreak
     \textheight:::::=\the\textheight\MessageBreak
     \textwidth::::::=\the\textwidth\MessageBreak
     \paperwidth:::::=\the\paperwidth\MessageBreak
     \paperheight::::=\the\paperheight\MessageBreak
     \topmargin::::::=\the\topmargin\MessageBreak
     \headheight:::::=\the\headheight\MessageBreak
     \headsep::::::::=\the\headsep\MessageBreak
     \footskip:::::::=\the\footskip\MessageBreak
     \topskip::::::::=\the\topskip\MessageBreak
     Now fixing the overlay in place
     }}{}
}
\def\@DRAFTdimen{%
 \setlength\LLY{\paperheight}
 \addtolength\LLY{-\textheight}
 \addtolength\LLY{-\headheight}
 \addtolength\LLY{-\headsep}
 \addtolength\LLY{-1in}
 \addtolength\LLY{-3pt}
 \setlength\LLX{1in}
 \ifodd\thepage
 \addtolength\LLX{\oddsidemargin}\else
 \addtolength\LLX{\evensidemargin}\fi
 \setlength\URX{\textwidth}
 \setlength\URY{\textheight}
}
\def\LoadWaterMark{\watermark}
\def\watermark{\AddToDraftOverlay{%
   \@DRAFTdimen%\@printdimen%
   \setlength{\@tempdima}{0pt}
   \setlength{\@tempdimb}{\paperwidth}
   \addtolength{\@tempdimb}{-\@tempdima}
   \addtolength{\@tempdimb}{-\@tempdima}
   \setlength{\@tempdimc}{\paperheight}
   \addtolength{\@tempdimc}{-\@tempdima}
   \addtolength{\@tempdimc}{-\@tempdima}
   \setlength{\unitlength}{1pt}\thinlines%
%
    \put(0,\strip@pt\paperheight){\fboxrule0pt\fboxsep0pt%
     %\fcolorbox{white}{red}%
     {\begin{minipage}[t][\paperheight][c]{\paperwidth}
     \centering
     \ifx\@@watermark\@empty\relax\else
     \includegraphics%[width=\paperwidth,height=\paperheight]%
     {\@@watermark}\fi%
     \end{minipage}}}}}%

\let\@@watermark\@empty
\def\watermarkgraphic#1{\gdef\@@watermark{#1}}

\def\draftcopy{\AddToDraftOverlay{%
   \@DRAFTdimen%\@printdimen%
   \setlength{\@tempdima}{0pt}
   \setlength{\@tempdimb}{\paperwidth}
   \addtolength{\@tempdimb}{-\@tempdima}
   \addtolength{\@tempdimb}{-\@tempdima}
   \setlength{\@tempdimc}{\paperheight}
   \addtolength{\@tempdimc}{-\@tempdima}
   \addtolength{\@tempdimc}{-\@tempdima}
   \setlength{\unitlength}{1pt}\thinlines%
%
    \put(0,\strip@pt\paperheight){\fboxrule0pt\fboxsep0pt%
     %\fcolorbox{white}{red}%
     {\begin{minipage}[t][\paperheight][c]{\paperwidth}
     \centering
     \begingroup
     \rotatebox{\@draftangle}{\color{\@draftcolor}
     \fontfamily{\@draftfontfamily}%
     \fontsize{\@draftfontsize}{\@draftfontsize}\selectfont
     {\@draftfontattrib\@draftstring}
     }\endgroup
     \end{minipage}}}}}%

\def\@draftangle{45}
\def\@draftstring{DRAFT COPY}
\def\@draftcolor{gray10}
\def\@draftfontfamily{ptm}
\def\@draftfontsize{80}
\def\@draftfontattrib{\upshape}
\def\draftstring#1{\gdef\@draftstring{#1}}
\def\draftcolor#1{\gdef\@draftcolor{#1}}
\def\draftfontfamily#1{\gdef\@draftfontfamily{#1}}
\def\draftfontsize#1{\gdef\@draftfontsize{#1}}
\def\draftfontattrib#1{\gdef\@draftfontattrib{#1}}
\def\draftangle#1{\gdef\@draftangle{#1}}
\endinput
%%
%%
%% End of package 'pdfdraftcopy.sty'
%%
